package com.bnp.reporting.java8.collection;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by adib on 11/11/14.
 */
public class ParallelStreams {
    public static void main(String[] args) {
        System.out.println("Crating List:");
        List<String> strings = new ArrayList<>();
        for(int i = 0; i < 10000; i++){
            strings.add("Item " + i);
        }

        strings.stream()
                .forEach((str -> System.out.println(str)));

        System.out.println("--------------------------------");
        // breaking tasks between processors, items order ?
        strings.stream()
                .parallel()
                .forEach((str -> System.out.println(str)));

    }
}
